<template>
	<view class="viewBg">
		<view class="article-meta">
			<text class="article-author">{{title}}</text>
			<text class="article-text">正在打开pdf...</text>
		</view>
		<view class="lineH2"></view>

<!--		<view class="article-content">-->
<!--			<rich-text :nodes="content"></rich-text>-->
<!--		</view>-->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "",
				publishDate: '',
				content: ''
			}
		},
		onLoad(data) {
			if (data) {
				this.title = data.title;
				this.publishDate = data.time;
				this.content = data.content;
                uni.downloadFile({
                    url: 'http://grid.tripln.top'+data.content,
                    success: function (res) {
                        var filePath = res.tempFilePath;
                        uni.openDocument({
                            filePath: filePath,
                            success: function (res) {
                                console.log('打开文档成功');
                            }
                        });
                    }
                });
			}
		}
	}
</script>

<style>
	.viewBg {
		width: 100%;
		height: 100%;
	}

	.lineH2 {
		height: 32upx;
		width: 100%;
		background-color: #F7F7F7;
	}

	.article-meta {
		padding: 20upx 40upx;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		color: gray;
	}

	.article-text {
		font-size: 26upx;
		line-height: 30upx;
		text-align: right;
		margin: 0 20upx, 20upx, 0;
	}

	.article-author,
	.article-time {
		font-size: 36upx;
		text-align: center;
		color: #000000;
	}

	.article-content {
		padding: 0 30upx;
		overflow: hidden;
		font-size: 30upx;
		margin-bottom: 30upx;
	}
</style>
